﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Win32;
using System.Reflection;

namespace TimeTracker.Miscellaneous
{
    public class SettingsEvents
    {
        public static void Default_SettingsSaving(object sender, System.ComponentModel.CancelEventArgs e)
        {
            if (Properties.Settings.Default.StartAtLogin)
            {
                string RunAtStartup = (string)Registry.CurrentUser.GetValue(@"Software\Microsoft\Windows\CurrentVersion\Run\DJTimeTracker", null);

                if (RunAtStartup == null)
                {
                    Registry.CurrentUser.SetValue(@"Software\Microsoft\Windows\CurrentVersion\Run\DJTimeTracker", Assembly.GetExecutingAssembly().Location);
                }
            }
        }
    }
}
